package com.example.jeong.yuejian10.Model;


import com.example.jeong.yuejian10.Bean.CommentBean;
import com.example.jeong.yuejian10.Service.CommentService;

import java.util.List;

import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

import static com.example.jeong.yuejian10.constant.Constant.BASE_URL;


public class CommentModel {
    private Retrofit retrofit;
    public CommentModel(){
        //创建实例
        retrofit = new Retrofit.Builder()
                .baseUrl(BASE_URL)
                .addConverterFactory(GsonConverterFactory.create())
                .build();
    }
    //帖子的评论
    public Call<List<CommentBean>> getCommentList(int p_id){
        CommentService commentService = retrofit.create(CommentService.class);
        return commentService.getPostComment(p_id);

    }

    //发表评论
    public Call<CommentBean> commentPost(int p_id, int u_id, String commentpost){
        CommentService commentService = retrofit.create(CommentService.class);
        return commentService.addComment(p_id,u_id,commentpost);
    }


}
